<?php

namespace Swof\Foundation\Bootstrap;

use Swof\Foundation\Application;
use Swof\Support\Facades\Facade;

class RegisterFacades
{
    /**
     * Bootstrap the given application.
     *
     * @param Application $app
     * @return void
     * @throws \Exception
     */
    public function bootstrap(Application $app)
    {
        Facade::clearResolvedInstances();

        Facade::setFacadeApplication($app);

        $config = require ($app->basePath('config/app.php'));

        foreach ($config['aliases'] as $key => $class) {
            $app->singleton(strtolower($key), $class);
        }

    }
}